package com.xique.park.controller.auto;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xique.common.log.annotation.Log;
import com.xique.common.log.enums.BusinessType;
import com.xique.common.security.annotation.PreAuthorize;
import com.xique.park.bean.domain.ParkLanePayPp;
import com.xique.park.service.service.IParkLanePayPpService;
import com.xique.common.core.web.controller.BaseController;
import com.xique.common.core.web.domain.AjaxResult;
import com.xique.common.core.utils.poi.ExcelUtil;
import com.xique.common.core.web.page.TableDataInfo;

/**
 * 第三方支付通道配置关联（p云）Controller
 * 
 * @author xique
 * @date 2021-12-09
 */
@RestController
@RequestMapping("/lanePayPp")
public class ParkLanePayPpController extends BaseController
{
    @Autowired
    private IParkLanePayPpService parkLanePayPpService;

    /**
     * 查询第三方支付通道配置关联（p云）列表
     */
    @PreAuthorize(hasPermi = "park:pp:list")
    @GetMapping("/list")
    public TableDataInfo list(ParkLanePayPp parkLanePayPp)
    {
        startPage();
        List<ParkLanePayPp> list = parkLanePayPpService.selectParkLanePayPpList(parkLanePayPp);
        return getDataTable(list);
    }

    /**
     * 导出第三方支付通道配置关联（p云）列表
     */
    @PreAuthorize(hasPermi = "park:pp:export")
    @Log(title = "第三方支付通道配置关联（p云）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ParkLanePayPp parkLanePayPp) throws IOException
    {
        List<ParkLanePayPp> list = parkLanePayPpService.selectParkLanePayPpList(parkLanePayPp);
        ExcelUtil<ParkLanePayPp> util = new ExcelUtil<ParkLanePayPp>(ParkLanePayPp.class);
        util.exportExcel(response, list, "第三方支付通道配置关联（p云）数据");
    }

    /**
     * 获取第三方支付通道配置关联（p云）详细信息
     */
    @PreAuthorize(hasPermi = "park:pp:query")
    @GetMapping(value = "/{laneId}")
    public AjaxResult getInfo(@PathVariable("laneId") Long laneId)
    {
        return AjaxResult.success(parkLanePayPpService.selectParkLanePayPpById(laneId));
    }

    /**
     * 新增第三方支付通道配置关联（p云）
     */
    @PreAuthorize(hasPermi = "park:pp:add")
    @Log(title = "第三方支付通道配置关联（p云）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ParkLanePayPp parkLanePayPp)
    {
        return toAjax(parkLanePayPpService.insertParkLanePayPp(parkLanePayPp));
    }

    /**
     * 修改第三方支付通道配置关联（p云）
     */
    @PreAuthorize(hasPermi = "park:pp:edit")
    @Log(title = "第三方支付通道配置关联（p云）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ParkLanePayPp parkLanePayPp)
    {
        return toAjax(parkLanePayPpService.updateParkLanePayPp(parkLanePayPp));
    }

    /**
     * 删除第三方支付通道配置关联（p云）
     */
    @PreAuthorize(hasPermi = "park:pp:remove")
    @Log(title = "第三方支付通道配置关联（p云）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{laneIds}")
    public AjaxResult remove(@PathVariable Long[] laneIds)
    {
        return toAjax(parkLanePayPpService.deleteParkLanePayPpByIds(laneIds));
    }
}
